;;; packages.el --- lgs layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2017 Sylvain Benner & Contributors
;;
;; Author:  <44228@LG18>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3

;;; Commentary:

;; See the Spacemacs documentation and FAQs for instructions on how to implement
;; a new layer:
;;
;;   SPC h SPC layers RET
;;
;;
;; Briefly, each package to be installed or configured by this layer should be
;; added to `lgs-packages'. Then, for each package PACKAGE:
;;
;; - If PACKAGE is not referenced by any other Spacemacs layer, define a
;;   function `lgs/init-PACKAGE' to load and initialize the package.

;; - Otherwise, PACKAGE is already referenced by another Spacemacs layer, so
;;   define the functions `lgs/pre-init-PACKAGE' and/or
;;   `lgs/post-init-PACKAGE' to customize the package as it is loaded.

;;; Code:

(defconst lgs-packages
  '()
  )
(add-to-list 'load-path
             "~/.emacs.d/private/mysettings/")

(require 'mysettings)

                                        ;org mode
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)
(add-to-list 'load-path
             "~/.emacs.d/private/ace-jump-mode/")


(require 'ace-jump-mode)
(global-set-key [(C-f8)] 'ace-jump-mode)

                                        ;blog将临时BUF设置为不可见，否则发布博客之后光标会跳转到另外一个buf中。
(add-to-list 'load-path
             "~/.emacs.d/private/misc/")


(require 'cnblogs)

(setq org-export-show-temporary-export-buffer nil)
(add-hook 'org-mode-hook (lambda ()
                           (cnblogs-minor-mode)))
                                        ;专属snippet
(global-set-key "\C-xt" 'yas-expand)
(global-set-key "\C-cq" 'helm-yas-complete)
(load-file "~/.emacs.d/private/macro/myMacro.el")
;;这里打开替换的快捷键
(global-set-key [(C-f3)] 'name-last-kbd-macro)     
(global-set-key [(C-f4)] 'insert-kbd-macro)
(defun open-macro-file()
  "打开宏记录文件"
  (interactive)
  (split-window-below)
  (other-window 1)
  (find-file "~/.emacs.d/private/macro/myMacro.el"))
(global-set-key [(C-f1)] 'open-macro-file)

                                        ;汉字字体
(dolist (charset '(kana han cjk-misc bopomofo))
  (set-fontset-font (frame-parameter nil 'font) charset
                    (font-spec :family "微软雅黑" :size 20)))
                                        ;默认F3是录制宏，F4是停止录制，C-x x回放宏
(global-set-key (kbd "C-x x") 'call-last-kbd-macro)
                                        ;快速切换至上个buffer
(global-set-key (kbd "<backtab>") #'(lambda ()
                                      (interactive)
                                      (switch-to-buffer (other-buffer (current-buffer) 1))))
                                        ; 逗号后自动加空格      
(global-set-key (kbd ",")
                #'(lambda ()
                    (interactive)
                    (insert ", ")))
;;c-c spc 
(defun yasnippet-current-line ();; C-c SPC
  (interactive)
  (let ((current-line (string-trim-right (thing-at-point 'line t))))
    (end-of-line)
    (newline-and-indent)
    (yas-expand-snippet (yasnippet-string-to-template (string-trim current-line)))))

(defun yasnippet-string-to-template (string)
  (let ((count 1))
    (labels ((rep (text)
                  (let ((replace (format "${%d:%s}" count text)))
                    (incf count)
                    replace)))
      (replace-regexp-in-string "[a-zA-Z0-9]+" #'rep string))))

(global-set-key (kbd "C-c SPC") 'yasnippet-current-line)
;; 显示行号
(global-linum-mode)
(setq column-number-mode t)

;; 高亮括号配对
(electric-pair-mode)

;; 高亮括号配对
(show-paren-mode t)
(setq show-paren-style 'parenthesis)

;; 美化显示符号（elisp），比如lambda会显示为λ
(prettify-symbols-mode)
(global-prettify-symbols-mode 1)

                                        ;主题
dotspacemacs-themes '(jazz
                      solarized-dark
                      leuven
                      solarized-light)
;;时间使用24小时制
(setq display-time-24hr-format t)

(display-time-mode 1)




;;; packages.el ends here
;;; packages.el ends here
